<template>
  <view class="wrap">
    <u-cell-group>
      <u-cell-item hover-class="none" title="标题" :value="orderDetail.name"></u-cell-item>
      <u-cell-item hover-class="none" title="数量" :value="orderDetail.quantity"></u-cell-item>
      <u-cell-item hover-class="none" title="单价" :value="orderDetail.price | priceFixed"></u-cell-item>
      <u-cell-item hover-class="none" title="总价" :value="orderDetail.totalPrice | priceFixed"></u-cell-item>
      <u-cell-item hover-class="none" title="库存" :value="orderDetail.stock"></u-cell-item>
      <u-cell-item hover-class="none" title="采购员" :value="orderDetail.purchaser"></u-cell-item>
      <u-cell-item hover-class="none" title="日期" :value="orderDetail.date | moteDate"></u-cell-item>
      <u-cell-item hover-class="none" title="所属渠道" :value="orderDetail.channel"></u-cell-item>
      <u-cell-item hover-class="none" title="付款" :value="orderDetail.payment===1?'已付款':'未付款'"></u-cell-item>
      <u-cell-item hover-class="none" title="付款时间" :value="orderDetail.pay_date?orderDetail.pay_date:'无'"></u-cell-item>
      <u-cell-item hover-class="none" title="进项票" :value="orderDetail.invoice===0?'未开票':'已开票'"></u-cell-item>
      <u-cell-item hover-class="none" title="开票金额"
        :value="orderDetail.in_invoice?orderDetail.in_invoice:'无'"></u-cell-item>
      <u-cell-item hover-class="none" title="开票时间"
        :value="orderDetail.invoice_date?orderDetail.invoice_date:'无'"></u-cell-item>
      <u-cell-item hover-class="none" title="录入时间" :value="orderDetail.ent_date | moteDate"></u-cell-item>
      <u-cell-item hover-class="none" title="修改时间" :value="orderDetail.mod_date | moteDate"></u-cell-item>
    </u-cell-group>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        orderDetail: []
      };
    },
    filters: {
      moteDate(value) {
        if (value) {
          return value.substring(0, 10)
        }
      },
      priceFixed(value) {
        if(value){
          
        return value.toFixed(2)
        }
      }
    },
    onLoad(options) {
      if (options.item) {
        this.orderDetail = JSON.parse(decodeURIComponent(options.item))
        console.log('orderDetail', this.orderDetail);
        if (this.orderDetail.pay_date) {
          this.orderDetail.pay_date = this.orderDetail.pay_date.substring(0, 10)
        }
        if (this.orderDetail.invoice_date) {
          this.orderDetail.invoice_date = this.orderDetail.invoice_date.substring(0, 10)
        }
        if (this.orderDetail.in_invoice) {
          this.orderDetail.in_invoice = this.orderDetail.in_invoice.toFixed(2)
        }
      }
    }
  }
</script>

<style lang="scss" scoped>
  .wrap {
    /deep/ .u-icon__icon {
      display: none;
    }

    /deep/.u-cell__value {
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 1;
      overflow: hidden;
      text-overflow: ellipsis;
    }
  }
</style>